import { applyDecorators } from '@nestjs/common';
import { IsNumber, IsOptional } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty } from '@nestjs/swagger';

export function StatusValidate() {
  return applyDecorators(
    IsNumber(),
    IsOptional(),
    Type(() => Number),
  );
}

export function SortValidate() {
  return applyDecorators(
    IsNumber(),
    IsOptional(),
    Type(() => Number),
  );
}

export function IdValidate() {
  return applyDecorators(
    IsNumber(),
    IsOptional(),
    ApiProperty({ description: '用户ID', example: 1 }),
  );
}
